<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>物流数据</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- 城市选择样式 -->
  <link rel="stylesheet" type="text/css" href="../wuliu/css/index.css">
  <!--layui-->
  <link href="../wuliu/layui/css/layui.css" rel="stylesheet">
  <!--悬浮窗样式-->
  <link rel="stylesheet" type="text/css" href="../wuliu/jquerynav/css/nav.css">
  <!--<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">awesome图标样式-->
  <link rel="stylesheet" type="text/css" href="../wuliu/font-awesome-4.7.0/css/font-awesome.min.css">

  <!--<link rel="stylesheet" type="text/css" href="../wuliu/css/index.css">
  <script type="text/javascript" src="../wuliu/jquery-1.10.2/jquery.min.js"></script>
  <script type="text/javascript" src="../wuliu/jquerynav/js/nav.js"></script>
  <script type="text/javascript" src="../wuliu/js/streets-data.min.js"></script>
  <script type="text/javascript" src="../wuliu/js/cityPicker-2.0.5.js"></script>-->

  <style>
   /* input{
      !*border:1px solid #e5e5e5;*!
      border:1px solid #0a0a0a;
      border-radius:5px;
      padding:3px;
      margin: 5px 15px 5px -2px;
      text-align: center;
    }*/
    input{
       /*border:1px solid #e5e5e5;*/
       border:1px solid #0a0a0a;
       border-radius:5px;
       padding:10px;
       /*margin: 5px 15px 5px -2px;*/
       text-align: center;
       font-family: serif;
     }
  </style>
</head>
<body>

<table class="layui-hide" id="test" lay-filter="test"></table>

<script type="text/html" id="ID-table-demo-page-pagebar">
  <div class="layui-btn-container">
    <div class="layui-inline" title="页全选" ><i class="layui-icon layui-icon-star-fill">所有页 &nbsp;&nbsp;</i></div>
    <i class="layui-icon "> </i>
<!--    <button class="layui-btn layui-btn-sm" lay-event="footerDemoBtn1">页全选</button>-->
<!--    <input type="checkbox" name="" title="全选">-->
<!--    <button class="layui-btn layui-btn-sm" lay-event="footerDemoBtn2">底部按钮2</button>-->
    <input id="layTableAllChoose_page" type="checkbox" name="layTableAllChoose_page" lay-filter="layTableAllChoose_page" lay-skin="primary" lay-event="layTableAllChoose_page">
  </div>
</script>

<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container" style="display: inline-block">
    <!--<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
    <button class="layui-btn layui-btn-sm" lay-event="getData">获取当前页数据</button>
    <button class="layui-btn layui-btn-sm" lay-event="isAll">是否全选</button>-->
    <button class="layui-btn layui-btn-sm" lay-event="add" style="background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;font-size: 14px;">添加数据</button>
    <button class="layui-btn layui-btn-sm" lay-event="exportFile" style="background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;font-size: 14px;">导出数据</button>
    <a class="layui-btn layui-btn-sm" href="/jianyuetable" style="    background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;margin-left: 4px;font-size: 14px;">简约报表</a>
    <a class="layui-btn layui-btn-sm" lay-event="importFile" style="    background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;margin-left: 4px;font-size: 14px;">全量删除与导入</a>
    <a class="layui-btn layui-btn-sm" lay-event="moredelect" style="    background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;margin-left: 4px;font-size: 14px;">批量删除</a>
    <a class="layui-btn layui-btn-sm" lay-event="moreupdate" style="    background-color: rgb(250 250 250);
    color: #000;
    border: 1px;
    border-color: #e2e2e2;
    border-style: solid;
    width: 100px;
    height: 37px;
    margin-top: 3px;
    padding: 2px 1px;margin-left: 4px;font-size: 14px;">批量更新</a>


    <!--<button class="layui-btn layui-btn-sm layui-bg-blue" id="reloadTest">
        重载测试
        <i class="layui-icon layui-icon-down layui-font-12"></i>
    </button>-->
    <!--<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="multi-row">
      多行
    </button>
    <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="default-row">
      单行
    </button>-->

    <!--<button class="layui-btn layui-btn-sm" id="moreTest">
        更多测试
        <i class="layui-icon layui-icon-down layui-font-12"></i>
    </button>-->
  </div>
  <!--<div class="layui-form-item" STYLE="display: inline-block;
    margin-bottom: 0px;
    height: 21px;">
&lt;!&ndash;    <label class="layui-form-label">选择框</label>&ndash;&gt;
    <div class=" layui-col-md6">
      <select name="city" lay-verify="required">
        <option value=""></option>
        <option value="0">北京</option>
        <option value="1">上海</option>
        <option value="2">广州</option>
        <option value="3">深圳</option>
        <option value="4">杭州</option>
      </select>
    </div>
    <div class=" layui-col-md6" >
      <input type="text" name="fwp" required  lay-verify="required" placeholder="元" autocomplete="off" class="layui-input">
    </div>
  </div>-->

  <form class="layui-form layui-form-pane" action="" style="display: inline-block;margin-left: 0%;" >
   <!-- <div class="layui-form-item">-->
      <div class="layui-inline">
        <label class="layui-form-label">筛选字段</label>
        <div class="layui-input-inline">

          <select name="search" id="ziduan" required="required" lay-verify="required">
            <option value=""></option>
            <option value="ID">ID</option>
            <option value="code">公司编码</option>
            <option value="deliveryname">公司名称</option>
            <option value="sendcity">原寄地</option>
            <option value="receiveprovince">目的省</option>
            <option value="receivecity">目的城市</option>
            <option value="fww">首重重量</option>
            <option value="fwp">首重价格</option>
            <option value="wu">价段上限</option>
            <option value="wd">价段下限</option>
            <option value="wp">价段单价</option>
            <option value="fw">价格层次</option>
            <option value="discount">折扣</option>
            <option value="discounttype">折扣类型</option>
            <option value="flag">版本标记</option>
          </select>

        </div>
        <div class="layui-input-inline">
          <input class="layui-input " required="required" lay-verify="required" autocomplete="off" name="keyword" id="inputsearch" >
        </div>

      </div >
      <div class="layui-inline">
        <button type="submit" class="layui-btn layui-btn-primary"  lay-filter="data-search-btn" lay-event="search"><i class="layui-icon"></i> 搜 索</button>

<!--        <button type="button" class="layui-btn layui-btn-primary" id="searchBtn"><i class="layui-icon"></i> 搜 索</button>-->

      </div>
   <!-- </div>-->
  </form>

</script>

<script type="text/html" id="cityTpl">
  <select id="demoCity1" class="layui-border" lay-ignore>
    <option value="浙江杭州">浙江杭州</option>
    <option value="江西南昌">江西南昌</option>
    <option value="湖北武汉">湖北武汉</option>
  </select>

</script>

<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">更新</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<div id="showaddMessage" style="display: none;">

</div>

<div  style="font-family: serif;position: fixed;left: 15px;top: 1px;z-index: 999999;">
  <ul>
    <li>
      <i class="fa fa-home" aria-hidden="true" onclick="wuliuhaome()"></i>
      <!--<a href="/wuliutable" class="rota">首页</a>-->
    </li>
  </ul>
</div>

<div id="showadddata" style="width: 80%;margin: auto;margin-top: 10px;display: none">

  <!--<div th:insert="~{wuliu/tancity :: citycopy}"></div>-->
  <div class="container" style="width: 100%;text-align: center" >

    <div class="layui-col-md6">
      <h3 style="font-family: serif;">--请选择原寄城市--</h3>
      <div class="dome-main" style="margin: auto;margin-top: 10px;margin-left: 10px;margin-right: 10px;text-align: center;padding: 10px;font-family: serif;">
        <div class="city-picker-selector" id="city-picker-search" required="required" lay-verify="required" style="text-align: center;margin: auto;width: fit-content;"></div>
      </div>
    </div>



    <div class="layui-col-md6">
      <h3 style="font-family: serif;">--请选择目的城市--</h3>
      <div class="dome-main"  style="margin: auto;margin-top: 10px;margin-left: 10px;margin-right: 10px;text-align: center;padding: 10px;font-family: serif;">
        <div class="city-picker-selector" id="city-picker-search1" required="required" lay-verify="required" style="text-align: center;margin: auto;width: fit-content;"></div>
      </div>
    </div>



  </div>

  <form class="layui-form" action="">
    <div class="layui-col-md12" style="margin-bottom: 2px;margin-top: 15px">
      <label class="layui-form-label">快递公司</label>
      <div class="layui-input-block" id="gscheckbox" style="line-height: 2.5;">
        <input type="checkbox" th:each="attr : ${attrs}" th:name="${attr.getPname()}" th:title="${attr.getWuliuname()}" >
        <!--<input type="checkbox" name="sfcztp" title="顺丰纯重特配">
        <input type="checkbox" name="sfbk" title="顺丰标快" checked>
        <input type="checkbox" name="sfly" title="顺丰陆运">
        <input type="checkbox" name="jdths" title="京东特惠送">
        <input type="checkbox" name="jdtks" title="京东特快送">-->

      </div>
    </div>

    <div class="layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">重量区间</label>
      <div class="layui-input-inline" style="width: 100px;">
        <input type="text" name="wight_min" placeholder="min-kg" autocomplete="off" class="layui-input">
      </div>
      <!-- <div class="layui-form-mid">-</div> -->
      -
      <div class="layui-input-inline" style="width: 100px;">
        <input type="text" name="wight_max" placeholder="max-kg" autocomplete="off" class="layui-input">
      </div>
    </div>
    <!--<div class="layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">轻抛系数</label>
      <div class="layui-input-block">
        <input type="text" name="lctparabolic" required  lay-verify="required" placeholder="kg" autocomplete="off" class="layui-input">
      </div>
    </div>-->
    <div class="layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">首重重量</label>
      <div class="layui-input-block">
        <input type="text" name="fww" required  lay-verify="required" placeholder="kg" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class=" layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">首重价格</label>
      <div class="layui-input-block">
        <input type="text" name="fwp" required  lay-verify="required" placeholder="元" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="  layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">价段单价</label>
      <div class="layui-input-block">
        <input type="text" name="wp" required  lay-verify="required" placeholder="元" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class=" layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">价格层次</label>
      <div class="layui-input-block">
        <input type="text" name="fw" required  lay-verify="required" placeholder="1、2、3...，对应重量区间" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">折扣</label>
      <div class="layui-input-block">
        <input type="text" name="discount" required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-col-md6" style="margin-bottom: 10px;">
      <label class="layui-form-label">版本标记</label>
      <div class="layui-input-block">
        <input type="text" name="flag" required  lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-col-md4" style="margin-bottom: 10px;">
      <label class="layui-form-label">折扣类型</label>
      <div class="layui-input-block" style="width: 100%;">
        <input type="radio" name="discounttype" value="1" title="1">
        <input type="radio" name="discounttype" value="2" title="2" checked>
        <blockquote class="layui-elem-quote layui-quote-nm" style="font-size: 10px;padding-top: 5px;padding-bottom: 5px;">（1：起步N折，2：最低保价N元）</blockquote>
      </div>


    </div>

    <div class="layui-col-md6 layui-col-md-offset6" style="margin-top: 30px;">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</div>



<script src="../wuliu/layui/layui.js"></script>
<script type="text/javascript" src="../wuliu/jquery-1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="../wuliu/js/streets-data.min.js"></script>
<script type="text/javascript" src="../wuliu/js/cityPicker-2.0.5.js"></script>
<script>

  var selectvalue_cache = "null";
  var inputvalue_cache = "null";
  var TablepageAllChoose = false;
  var gcount;
  var gresult;
  var changeLIst = [];

  // var $ = layui.$ //重点处


  var formdata;
  function wuliuhaome(){
    window.location.href="/wuliu"
  }
  var mymap = new Map();

  var mapList = [];
  /*获取多选框内容*/
  function fu(){
    console.log($("input[type='checkbox']:checked").size())
    mapList = [];

    var i ;
    var gg;
    for (i = 0;$("input[type='checkbox']:checked").size() >i ;i++ ){
       gg = $("input[type='checkbox']:checked")[i]
      mymap.set(gg.name,gg.value);
      console.log(mymap);
      /*mapList[i]= gg.name;*/
      mapList.push(gg.name)
      console.log(mapList);
    }

    $("input[type='checkbox']:checked").each(function(){
      console.log(this.title+this.name+this.value);

    });
  }


  layui.use(['table', 'dropdown'], function(){
    var table = layui.table;
    var dropdown = layui.dropdown;
    /*layer.msg('本示例演示的数据为静态模拟数据，<br>实际使用时换成您的真实接口即可。', {
        closeBtn: 1,
        icon: 6,
        time: 21*1000,
        offset: '21px'
    });*/
    /*var laypage = layui.laypage;
    var count1 = 5872;
    function fenye(){
      //执行一个laypage实例
      laypage.render({
        elem: '#test' //注意，这里的 test1 是 ID，不用加 # 号
        ,count: count1 //数据总数，从服务端得到
        ,limit: 20,
      });
    }*/

    /*form.on('select', function(data){
     console.log(data.elem); //得到select原始DOM对象
     console.log(data.value); //得到被选中的值]
     $("#ziduan").val(data.value)
     console.log(data.othis); //得到美化后的DOM对象
   });*/

    var form = layui.form;

    /*//搜索
    form.on('submit(data-search-btn)', function(data){
      return false;
    });*/


    //提交
    form.on('submit(formDemo)', function(data){
      /*layer.msg(JSON.stringify(data.field));*/
      console.log(JSON.stringify(data.field));
      formdata = data;
      /*adddata(data.field);*/
      /*var sfcztp = data.field.sfcztp;
      var sfbk = data.field.sfbk;
      var sfly = data.field.sfly;
      var jdths = data.field.jdths;
      var jdtks = data.field.jdtks;

      var sdata = selector1.getCityVal();
      console.log(sdata[0].name);
      console.log(sdata[1].name);

      fromprovince = sdata[0].name;
      fromcity = sdata[1].name;

      var sdata2 = selector2.getCityVal();
      console.log(sdata2[0].name);
      console.log(sdata2[1].name);

      toprovince = sdata2[0].name;
      tocity = sdata2[1].name;*/



      var closeshow = document.getElementById("showadddata");
      closeshow.setAttribute("style", "width: 80%;margin: auto;margin-top: 10px;display: none");
      layer.close(tanindex);

      return false;
    });


    // 创建渲染实例
   var currenttable =  table.render({
     elem: '#test'
     ,id: 'test'
      ,url:'/getwuliutable' // 此处为静态模拟数据，实际使用时需换成真实接口
      ,toolbar: '#toolbarDemo'
      ,defaultToolbar: ['filter', 'exports', 'print', {
        title: '帮助'
        ,layEvent: 'LAYTABLE_TIPS'
        ,icon: 'layui-icon-tips'
      }]
      ,height: 'full-25' // 最大高度减去其他容器已占有的高度差
      ,cellMinWidth: 30  //列最小宽度
      //,totalRow: true // 开启合计行
      ,limit: 20
      ,limits: [20,50,100,500,1000,10000]
      ,page: true
     ,pagebar: '#ID-table-demo-page-pagebar' // 分页栏模板
      ,cols: [
        [
          {type: 'checkbox', fixed: 'left'}
          ,{field:'id', fixed: 'left', title: 'ID', sort: true, }
          ,{field:'code',  title: '公司编码'}
          ,{field:'deliveryname', title:'公司名称',}
          ,{field:'sendcity', title:'原寄地',}
          ,{field:'receiveprovince', title:'目的省',}
          ,{field:'receivecity', title:'目的城市',}
          ,{field:'fww', title:'首重重量',edit:true, sort: true}
          ,{field:'fwp', title:'首重价格',edit:true, sort: true}
          ,{field:'wu', title:'价段上限',edit:true, sort: true}
          ,{field:'wd', title:'价段下限',edit:true, sort: true}
          ,{field:'wp', title:'价段单价',edit:true, sort: true}
          ,{field:'fw', title:'价格层次',edit:true, sort: true}
          ,{field:'discount', title:'折扣',edit:true, sort: true}
          ,{field:'discounttype',  title: '折扣类型',edit:true, sort: true}
          //,{field:'lctparabolic',  title: '轻抛系数',edit:true, sort: true}
          //,{field:'sendprovince',  title: '原寄省份',edit:true, sort: true}
          ,{field:'flag',  title: '版本标记',edit:true, sort: true}
          ,{fixed: 'right', title:'操作',  minWidth: 125, toolbar: '#barDemo'}
        ]
      ],
      done:function (res,curr,count){
        //如果是异步请求数据方式，res即为你接口返回的信息。
        //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
        console.log(res);
        gresult = res;

        //得到当前页码
        console.log(curr);

        //得到数据总量
        console.log(count);
        gcount = count;


        if (TablepageAllChoose){


          for (var i = 0; i < res.data.length; i++) {
            textid = res.data[i].id;
            var hasValue = changeLIst.includes(textid);

            if (!hasValue){
              res.data[i]["LAY_CHECKED"] = 'true';
              //下面三句是通过更改css来实现选中的效果
              var index = res.data[i]['LAY_TABLE_INDEX'];
              $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true);
              $('tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked');


              var checkboxes = document.querySelectorAll('input[type="checkbox"][name="layTableCheckbox"][lay-filter="layTableAllChoose"]');
              var checkbox = checkboxes[1];
              checkbox.checked = true;
              checkbox["LAY_CHECKED"] = 'true';
              var nextElement = checkbox.nextElementSibling;
              nextElement.classList.add('layui-form-checked');
              //取消选择设置
              // $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', false);
              // $('tr[data-index=' + index + '] input[type="checkbox"]').next().removeClass('layui-form-checked');
            }

          }

        }

      }
      ,error: function(res, msg){
        console.log(res, msg)
      }
    });

    var index33

    form.on('checkbox(layTableAllChoose_page)', function (obj) {
      console.log(obj);
      // console.log(table);
      //获取当前表格数据，传入表格id
      // console.log(table.getData('test'));
      // console.log(table.getData('test').length);
      var res = gresult;

      var checkboxes = document.querySelectorAll('input[type="checkbox"][name="layTableCheckbox"][lay-filter="layTableAllChoose"]');
      var checkbox = checkboxes[1];

      if (obj.elem.checked == true ){
        console.log(TablepageAllChoose + " to true");
        TablepageAllChoose = true;
        changeLIst = [];
        for (var i = 0; i < res.data.length; i++) {
          res.data[i]["LAY_CHECKED"] = 'true';
          //下面三句是通过更改css来实现选中的效果
          var index = res.data[i]['LAY_TABLE_INDEX'];
          $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true);
          $('tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked');

        }
          checkbox.checked = true;
          checkbox["LAY_CHECKED"] = 'true';
          var nextElement = checkbox.nextElementSibling;
          nextElement.classList.add('layui-form-checked');

      }else if (obj.elem.checked == false ){
        console.log(TablepageAllChoose + " to false");
        TablepageAllChoose = false;
        changeLIst = [];
        for (var i = 0; i < res.data.length; i++) {
          res.data[i]["LAY_CHECKED"] = 'false';
          //下面三句是通过更改css来实现选中的效果
          var index = res.data[i]['LAY_TABLE_INDEX'];

          //取消选择设置
          $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', false);
          $('tr[data-index=' + index + '] input[type="checkbox"]').next().removeClass('layui-form-checked');

        }

        checkbox.checked = false;
        checkbox["LAY_CHECKED"] = 'false';
        var nextElement = checkbox.nextElementSibling;
        nextElement.classList.toggle('layui-form-checked');

      }

    });

    // 分页栏事件
    table.on('pagebar(test)', function(obj){
      console.log(obj); // 查看对象所有成员
      console.log(obj.config); // 当前实例的配置信息
      console.log(obj.event); // 属性 lay-event 对应的值
      var eventValue = obj.event; // 获得按钮 lay-event 值
      layer.msg(eventValue);
      switch(obj.event){
        case 'layTableAllChoose_page':
          console.log("分页栏事件:"+TablepageAllChoose);
          TablepageAllChoose = true;
          var id = obj.config.id;
          var checkStatus = table.checkStatus(id);

          /*// 获取表格数据
          var tableData = table.cache[id]; // 表格的id，例如：tableConfig.id = 'tableId'

          // 执行全选

            table.checkStatus(id).data.forEach(function(row) {
              row.LAY_CHECKED = true;
            });
            table.reload(id, {
              data: tableData
            });
*/


          break;
        case 'getData':
      }
    });

    // 工具栏事件
    table.on('toolbar(test)', function(obj){
      var id = obj.config.id;
      var checkStatus = table.checkStatus(id);
      var othis = lay(this);
      switch(obj.event){
        case 'getCheckData':
          var data = checkStatus.data;
          layer.alert(layui.util.escape(JSON.stringify(data)));
          break;
        case 'getData':
          var getData = table.getData(id);
          console.log(getData);
          layer.alert(layui.util.escape(JSON.stringify(getData)));
          break;
        case 'isAll':
          layer.msg(checkStatus.isAll ? '全选': '未全选')
          break;
        case 'multi-row':
          table.reload('test', {
            // 设置行样式，此处以设置多行高度为例。若为单行，则没必要设置改参数 - 注：v2.7.0 新增
            lineStyle: 'height: 95px;'
          });
          layer.msg('即通过设置 lineStyle 参数可开启多行');
          break;
        case 'default-row':
          table.reload('test', {
            lineStyle: null // 恢复单行
          });
          layer.msg('已设为单行');
          break;
        case 'LAYTABLE_TIPS':
          /*layer.alert('Table for layui-v'+ layui.v);*/
          layer.alert('龙工信息部开发！<br/>开发人员：马俊锋<br/>审核测试：蓝玉萍');
          break;
          case 'moredelect':
            var data = checkStatus.data;
            console.log(data);
            if (data.length == 0){
              layer.msg('请选择要删除的行');
              return false;
            }
            layer.confirm('数据将删除？', function(index){
              layer.close(index);
              //Prompt
              layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
                layer.close(index);
                if (pass === "wuliulonking"){
                  if (TablepageAllChoose){
                    var count = gcount - changeLIst.length;
                    layer.confirm('当前选择了所有页，是否仍要删除？本次将删除' +
                            '<span style=" font-size: 20px;margin: 5px;font-weight: 700;color: red;">'+count+'</span>条数据',
                            function(index){
                              deldata1(data);
                            });
                  }else {
                    deldata1(data);
                  }
                }else {
                  layer.msg('密码错误！');
                }
              });

            });
          break;
          case 'moreupdate':
            var data = checkStatus.data;
            console.log(data);
            if (data.length == 0){
              layer.msg('请选择要更新的行');
              return false;
            }
            layer.confirm('数据将保存？', function(index){

              layer.close(index);
              //Prompt
              layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
                layer.close(index);
                if (pass === "wuliulonking"){
                  updatedata1(data);
                }else {
                  layer.msg('密码错误！');
                  table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
                    scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
                  });
                }
              });

            });
          break;
        case 'exportFile':
          index33 = layer.load(1, {
            shade: [0.1,'#f5f1f1'] //0.1透明度的白色背景
          });
          exportFile();

          break;
          case 'importFile':
            var lohref="http://"+window.location.host+"/file/mubanroot.xlsx";
                  console.log(lohref)

            layer.confirm('请选择您的操作？', {
              btn: ['全部删除数据','批量导入'] //按钮
            }, function(){

              layer.confirm('警告！数据将全部删除！', function(index){

                layer.close(index);
                //Prompt
                layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
                  layer.close(index);
                  if (pass === "wuliulonking"){
                    deldataall();
                  }else {
                    layer.msg('密码错误！');
                  }
                });

              });
            }, function(){
              var index666 = layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['420px', '240px'], //宽高
                title: '批量导入(导入前请先解密文档)',
                content: '<div style="margin: auto;text-align: center;margin-top: 10%;"><button type="button" class="layui-btn" id="upexcel">\n' +
                        '  <i class="layui-icon">&#xe67c;</i>上传文件\n' +
                        '</button><div style="width: 95px;margin: auto;margin-top: 15px;width: 200px;" id="showprogress">\n' +
                        '            <div class="layui-progress layui-progress-big" lay-showpercent="yes" lay-filter="demo" id="demo">\n' +
                        '                <div class="layui-progress-bar" lay-percent=""></div>\n' +
                        '            </div>\n' +
                        '        </div><a style="margin-top: 10px" class="layui-btn layui-btn-radius layui-btn-primary" href="'+lohref+'" download="muban.xlsx">下载模板</a>' +
                        '</div>'
              });

              var importFileload;


              var upload = layui.upload;

              //执行实例
              var uploadInst = upload.render({
                elem: '#upexcel' //绑定元素
                ,url: '/importexcel' //上传接口
                ,accept: 'file' //普通文件
                ,exts: 'xls|xlsx' //只允许上传压缩文件
                ,done: function(res){
                  layer.close(importFileload);
                  //上传完毕回调
                  console.log(res)
                  var faildresult = '';
                  var ki=1;
                  for (var key in res.data.faildreason) {
                    console.log(res.data.faildreason[key]);
                    faildresult += ki+":"+ res.data.faildreason[key] +":"+key +"<br />";
                    ki++
                  }
                  //layer.alert("上传成功："+res.data.success+"上传失败："+res.data.false)
                  var confirm2=layer.open({
                    type : 1
                    , //area : [ '30%', '30%' ],
                    title:'回调数据'
                    ,maxmin:true
                    ,btn: ['下载失败数据','查看新增'] //按钮
                    , content : "<blockquote class=\"layui-elem-quote layui-quote-nm\" style=\"font-size: 10px;padding-top: 5px;padding-bottom: 5px;text-align: center;font-family: inherit;\n" +
                            "  \">上传成功：<span class=\"layui-badge-rim\" style=\"height: auto; \">"+res.data.success+"</span></blockquote>" +
                            "<hr />"+"<blockquote class=\"layui-elem-quote layui-quote-nm\" style=\"font-size: 10px;padding-top: 5px;padding-bottom: 5px;text-align: center;font-family: inherit;\n" +
                            "    \"><div>上传失败：</div><span class=\"layui-badge-rim\" style=\"height: auto; \">"+faildresult+"</span></blockquote>"
                    ,cancel: function (){ //右上角关闭
                      console.log("关闭了弹窗！")
                      /* var closeshow = document.getElementById("showadddata");
                       closeshow.setAttribute("style", "width: 80%;margin: auto;margin-top: 10px;display: none");*/
                    },
                    yes: function (index,layero){

                      /*table.exportFile(['公司编码','公司名称','原寄地','目的省','目的城市','首重重量','首重价格','价段上限','价段下限','价段单价','价格层次','折扣','折扣类型','轻抛系数','原寄省','版本标记'],
                              [
                                JSON.stringify(res.data.false)
                              ],
                              {
                        type: 'xls', // 导出格式
                        title: '导出文件'
                      });*/

                      var timestart = Date.now();

                      table.exportFile(currenttable.config.id, res.data.false,{type:'xls',title:'失败数据'});
                      var timeend = Date.now();

                      layer.close(index666);


                      var spent = (timeend - timestart) / 1000;
                      layer.alert('单纯导出耗时 '+spent+' s');

                    },
                    btn2: function (index,layero){
                      console.log(res.data.success);
                      if (res.data.success.length ==0){
                        layer.msg('无新增数据！')
                        return false;
                      }
                      layui.table.reload('test', {
                        page: {
                          curr: 1 //重新从第 1 页开始
                        }
                        ,url:'/getwuliutablebyid'
                        ,where: {
                          idlist : JSON.stringify(res.data.success)
                        }
                      });

                      layer.close(index666);

                    }
                  });
                }
                ,progress: function(n, elem, res, index){
                  var percent = n + '%' //获取进度百分比
                  console.log("进度"+n);
                  if (n == 100){
                    importFileload=layer.load(3, {
                      shade: [0.1, '#fff'],
                      content: '<span class="loadtip">数据保存中，请稍等</span>',
                      success: function (layer) {
                        layer.find('.layui-layer-content').css({
                          'padding-top': '30px',
                          'width': '200px',
                        });
                        layer.find('.loadtip').css({
                          'font-size':'18px',
                          'margin-left':'-48px'
                        });
                      }
                    });
                  }
                  layui.element.progress('demo', percent); //可配合 layui 进度条元素使用

                  console.log(elem); //得到当前触发的元素 DOM 对象。可通过该元素定义的属性值匹配到对应的进度条。
                  console.log(res); //得到 progress 响应信息
                  console.log(index); //得到当前上传文件的索引，多文件上传时的进度条控制，如：
                  layui.element.progress('demo-'+ index, n + '%'); //进度条
                }
                ,error: function(){
                  //请求异常回调
                }
              });


            });






          break;
        case 'add':
          tanindex=layer.open({
            type : 1
            , area : [ '80%', '95%' ],
            title:'添加数据'
            ,maxmin:true
            , content : $('#showadddata')
            ,cancel: function (){ //右上角关闭
              console.log("关闭了弹窗！")
              var closeshow = document.getElementById("showadddata");
              closeshow.setAttribute("style", "width: 80%;margin: auto;margin-top: 10px;display: none");


            }
          });

          break;
        case 'search':
          var selectvalue = $('#ziduan').val();
          console.log(selectvalue);
          var inputvalue = $('#inputsearch').val();
          console.log(inputvalue);

          var selects = document.getElementById("ziduan");
          var indexs = selects.options.selectedIndex;  //选中项的索引
          console.log(indexs);

          if (!inputvalue){
            layer.msg("输入为空！");
            break;
          }

          if (!selectvalue){
            layer.msg("下拉选择为空！");
            break;
          }
          // selectvalue_cache = selectvalue;
          // inputvalue_cache = inputvalue;

          layui.table.reload('test', {
            page: {
              curr: 1 //重新从第 1 页开始
            }
            ,url:'/searchwuliutable'
            ,where: {
              inputvalue : inputvalue,
              selectvalue : selectvalue
            }
          });

          document.getElementById("ziduan").options[indexs].selected = true;
          document.getElementById("inputsearch").value = inputvalue;

          break;
      };
    });

    var tanindex;

    //触发单元格工具事件
    table.on('tool(test)', function(obj){ // 双击 toolDouble
      var data = obj.data;
      //console.log(obj)
      if(obj.event === 'del'){
        /*layer.confirm('真的删除行么', function(index){
          obj.del();
          layer.close(index);
        });*/
        console.log(data)
        console.log(obj.event)
        console.log(obj.tr)
        layer.confirm('数据将删除？', function(index){
          /*obj.del();
          layer.close(index);*/
          layer.close(index);
          //Prompt
          layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
            layer.close(index);
            if (pass === "wuliulonking"){
              deldata(data);
            }else {
              layer.msg('密码错误！');
            }
          });

        });
      } else if(obj.event === 'edit'){
        /*var data = checkStatus.data;
        layer.alert(layui.util.escape(JSON.stringify(data)));*/

        console.log(data)
        console.log(obj.event)
        console.log(obj.tr)
        layer.confirm('数据将保存？', function(index){
          /*obj.del();
          layer.close(index);*/
          layer.close(index);
          //Prompt
          layer.prompt({title: '请输入密码，并确认', formType: 1}, function(pass, index){
            layer.close(index);
            if (pass === "wuliulonking"){
              updatedata(data);
            }else {
              layer.msg('密码错误！');
              table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
                scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
              });
            }
          });

        });
        /*layer.open({
            title: '编辑',
            type: 1,
            area: ['80%','80%'],
            content: '<div style="padding: 16px;">自定义表单元素</div>'
        });*/
      }
    });

    function exportFile(){
      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        url: "/exportFile" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {
            console.log(data)
            /*data.unshift({ id: "ID", code: "公司编码", deliveryname: '公司名称', sendcity: '原寄地', receiveprovince: '目的省', receivecity: '目的城市',
              fww: '首重重量', fwp: '首重价格', wu: '价段上限', wd: '价段下限', wp: '价段单价', fw: '价格层次',discount: '折扣', discounttype: '折扣类型' });*/

            var timestart = Date.now();

            table.exportFile(currenttable.config.id, data.data,{type:'xls',title:'物流数据'});
            var timeend = Date.now();

            layer.close(index33);


            var spent = (timeend - timestart) / 1000;
            layer.alert('单纯导出耗时 '+spent+' s');

          }

        }

      });
    }

    function deldata(data){
      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        data:{
          sdata: data.id,
          mode: 1,
          ISTablepageAllChoose : TablepageAllChoose,
          selectvalue: selectvalue_cache,
          inputvalue: inputvalue_cache,
        },
        url: "/delwuliutable" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {
            console.log(data)
            result = data.result;
            layer.msg(result);
            table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
              scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
            });

          }

        }

      });
    }

    function updatedata(data){
      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        data:{
          sdata:JSON.stringify(data),
          mode:1
        },
        url: "/upwuliutable" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {
            console.log(data)
            result = data.result;
            layer.msg('成功更新数据'+result+'条');
            table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
              scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
            });

          }

        }

      });
    }

    function deldata1(data){
      //  如果选中了页全选，则获取下面两个数据
      //    selectvalue;
      //    inputvalue;

      var selectvalue = $('#ziduan').val();
      console.log(selectvalue);
      var inputvalue = $('#inputsearch').val();
      console.log(inputvalue);

      var llist=[];
      for(var i=0;data.length>i;i++){
        llist.push(data[i].id);
      }
      console.log(llist);
      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        data:{
          sdata : JSON.stringify(llist),
          mode : 2,
          ISTablepageAllChoose : TablepageAllChoose,
          selectvalue: selectvalue,
          inputvalue: inputvalue,
          exclude: JSON.stringify(changeLIst),
        },
        url: "/delwuliutable" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {

            console.log(data)
            result = data.result;
            layer.alert(result);
            table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
              scrollPos: 'fixed',  // 保持滚动条位置不变 - v2.7.3 新增
              page: {
                curr: 1 //重新从第 1 页开始
              }
            });

            changeLIst = [];
            TablepageAllChoose = false;
            var checkboxes = document.querySelectorAll('input[type="checkbox"][name="layTableAllChoose_page"][lay-filter="layTableAllChoose_page"]');
            var checkbox = checkboxes[0];
            checkbox.checked = false;
            checkbox["LAY_CHECKED"] = 'false';
            //选择它下一个相邻元素
            var nextElement = checkbox.nextElementSibling;
            //删除class里的layui-form-checked
            nextElement.classList.toggle('layui-form-checked');

            var checkboxes = document.querySelectorAll('input[type="checkbox"][name="layTableCheckbox"][lay-filter="layTableAllChoose"]');
            var checkbox = checkboxes[1];
            checkbox.checked = false;
            checkbox["LAY_CHECKED"] = 'false';
            //选择它下一个相邻元素
            var nextElement = checkbox.nextElementSibling;
            //删除class里的layui-form-checked
            nextElement.classList.toggle('layui-form-checked');

          }

        }

      });
    }

    function updatedata1(data){
      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        data:{
          sdata : JSON.stringify(data),
          mode : 2
        },
        url: "/upwuliutable" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {
            console.log(data)
            result = data.result;
            layer.msg('成功更新数据'+result+'条');
            table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
              scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
            });

          }

        }

      });
    }

    function deldataall(){

      $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        url: "/delAllwuliutable" ,//url
        success: function (data) {
          console.log(data)
          if (data.msg === '0'){
            console.log("失败");
            alert("失败："+JSON.stringify(data))
          }else {
            console.log(data)
            result = data.result;
            layer.msg(result);
            table.reloadData('test', {// 当发送后端请求成功后，可再通过 reloadData 方法完成数据重载
              scrollPos: 'fixed'  // 保持滚动条位置不变 - v2.7.3 新增
            });

          }

        }

      });
    }



    //触发表格复选框选择
    table.on('checkbox(test)', function(obj){
      console.log(obj)
      // console.log(obj.data)
      // console.log(obj.tr)
      /*if (obj.checked == true &&obj.type == "all"){
        console.log(TablepageAllChoose);
        TablepageAllChoose = true;
      }else if (obj.checked == false &&obj.type == "all"){
        console.log(TablepageAllChoose);
        TablepageAllChoose = false;
      }*/

      /*
      * table.getData('test')   获取当前页所有数据 数组
      * table.checkStatus('test')  获取当前页选中行数据 数组
      * gresult   获取当前页所有数据+选中状态 对象
      * */



      if (TablepageAllChoose){
        var data = table.getData('test')

        if (obj.type == 'all'){
            if (table.checkStatus('test').isAll){
              for (var i = 0; i < data.length; i++) {
                var valueToRemove = data[i].id;
                var hasValue = changeLIst.includes(valueToRemove);
                //console.log(hasValue); // 输出: true
                if (hasValue){
                  changeLIst = changeLIst.filter(function(element) {
                    return element !== valueToRemove;
                  });

                }
              }
              console.log(1)
            }else {
              for (var i = 0; i < data.length; i++) {
                var valueToAdd = data[i].id;
                var hasValue = changeLIst.includes(valueToAdd);
                //console.log(hasValue); // 输出: true
                if (!hasValue){
                  changeLIst.push(valueToAdd);
                }
              }

              console.log(2)
            }

        }else if (obj.type == 'one'){
          if (obj.checked){

            var valueToRemove = obj.data.id;
            var hasValue = changeLIst.includes(valueToRemove);
            //console.log(hasValue); // 输出: true
            if (hasValue){
              changeLIst = changeLIst.filter(function(element) {
                return element !== valueToRemove;
              });

            }

          }else {
            var valueToAdd = obj.data.id;
            var hasValue = changeLIst.includes(valueToAdd);
            //console.log(hasValue); // 输出: true
            if (!hasValue){
              changeLIst.push(valueToAdd);
            }

          }

          console.log(3)}

      }



    });

    //触发表格单选框选择
    table.on('radio(test)', function(obj){
      console.log(obj)

    });

    // 行单击事件
    table.on('row(test)', function(obj){
      //console.log(obj);
      //layer.closeAll('tips');
    });
    // 行双击事件
    table.on('rowDouble(test)', function(obj){
      //alert(obj)
      console.log(obj);
    });

    // 单元格编辑事件
    table.on('edit(test)', function(obj){
      var field = obj.field //得到字段
              ,value = obj.value //得到修改后的值
              ,data = obj.data; //得到所在行所有键值

      var update = {};
      update[field] = value;
      obj.update(update);
    });
  });

  var fromcity;
  var fromprovince;
  var tocity;
  var toprovince;

  var sdata;
  var sdata2;





  $('.layui-btn').on('click',function search(){
    sdata = selector1.getCityVal();
    console.log(sdata[0].name);
    console.log(sdata[1].name);

    fromprovince = sdata[0].name;
    fromcity = sdata[1].name;

    sdata2 = selector2.getCityVal();
    console.log(sdata2);
    if (sdata2.length == 0){
      layer.msg("请选择目的地");
      return false;
    }
    console.log(sdata2[0].name);
    console.log(sdata2[1].name);

    toprovince = sdata2[0].name;
    tocity = sdata2[1].name;

    setTimeout(function (){
      console.log('表格数据：'+JSON.stringify(formdata))
      adddata(formdata);
    },200)


  });



  function adddata(data){
    console.log(data);
    console.log(sdata);
    console.log(sdata2);
    fu();
    console.log(mymap);

    if (mymap.size == 0){
      layer.msg("请选择快递公司！");
      return false;
    }
    console.log(JSON.stringify(mapList));
    var mpl=JSON.stringify(mapList)

    let obj= Object.create(null);
    for (let[k,v] of mymap) {
      obj[k] = v;
    }
    console.log(obj);
    var myobj=JSON.stringify(obj);
    console.log(myobj)

    var sfcztp = data.field.sfcztp;
    var sfbk = data.field.sfbk;
    var sfly = data.field.sfly;
    var jdths = data.field.jdths;
    var jdtks = data.field.jdtks;

    var wight_min = data.field.wight_min;
    var wight_max = data.field.wight_max;
    var lctparabolic = data.field.lctparabolic;
    var fww = data.field.fww;
    var fwp = data.field.fwp;
    var fw = data.field.fw;
    var wp = data.field.wp;
    var discount = data.field.discount;
    var discounttype = data.field.discounttype;
    var flag = data.field.flag;

    $.ajax({
      //几个参数需要注意一下
      type: "POST",//方法类型
      dataType: "json",//预期服务器返回的数据类型
      url: "/addwuliudata" ,//url
      data:{
        map :myobj,
        mapList : mpl,
        sfcztp : sfcztp,
        sfbk : sfbk,
        sfly : sfly,
        jdths : jdths,
        jdtks : jdtks,
        wd : wight_min,
        wu : wight_max,
        lctparabolic : lctparabolic,
        fww : fww,
        fwp : fwp,
        fw : fw,
        wp : wp,
        discount : discount,
        discounttype : discounttype,
        flag : flag,

        fromprovince : fromprovince,
        sendcity : fromcity,
        receiveprovince : toprovince,
        receivecity : tocity,
      },
      success: function (data) {
        if (data.msg === '0'){
          console.log("失败路线："+JSON.stringify(data.falseresult));
          alert("查询错误："+JSON.stringify(data.falseresult))
        }else {
          console.log(data)
          //layer.msg("应编辑无需新增："+data.toedit+"对应id："+data.toeditid+"已新增："+data.canadd+"已新增id："+data.canaddid)
         // layer.alert("应编辑无需新增："+data.toedit+"对应id："+data.toeditid+"已新增："+data.canadd+"已新增id："+data.canaddid)
          var confirm2=layer.open({
            type : 1
            , area : [ '30%', '30%' ],
            title:'回调数据'
            ,maxmin:true
            ,btn: ['去编辑','查看新增'] //按钮
            , content : "<blockquote class=\"layui-elem-quote layui-quote-nm\" style=\"font-size: 10px;padding-top: 5px;padding-bottom: 5px;text-align: center;font-family: inherit;\n" +
                    "  \">应编辑无需新增：<span class=\"layui-badge-rim\" style=\"height: auto; \">"+data.toedit+"</span><br />对应id：<span class=\"layui-badge-rim\" style=\"height: auto; \">"+data.toeditid+"</span></blockquote>" +
                    "<hr />"+"<blockquote class=\"layui-elem-quote layui-quote-nm\" style=\"font-size: 10px;padding-top: 5px;padding-bottom: 5px;text-align: center;font-family: inherit;\n" +
                    "    \">已新增：<span class=\"layui-badge-rim\" style=\"height: auto; \">"+data.canadd+"</span><br />已新增id：<span class=\"layui-badge-rim\" style=\"height: auto; \">"+data.canaddid+"</span></blockquote>"
            ,cancel: function (){ //右上角关闭
              console.log("关闭了弹窗！")
             /* var closeshow = document.getElementById("showadddata");
              closeshow.setAttribute("style", "width: 80%;margin: auto;margin-top: 10px;display: none");*/
            },
            yes: function (index,layero){
              layui.table.reload('test', {
                page: {
                  curr: 1 //重新从第 1 页开始
                }
                ,url:'/getwuliutablebyid'
                ,where: {
                  idlist : JSON.stringify(data.toeditid)
                }
              });

            },
            btn2: function (index,layero){
              layui.table.reload('test', {
                page: {
                  curr: 1 //重新从第 1 页开始
                }
                ,url:'/getwuliutablebyid'
                ,where: {
                  idlist : JSON.stringify(data.canaddid)
                }
              });

            }
          });

        }

      },
      error : function (data){

      }

    });

  }

  // 模拟城市-联动/搜索/键盘操作
  var selector1 = $('#city-picker-search').cityPicker({
    dataJson: cityData,
    renderMode: true,
    search: true,
    autoSelected: true,
    shorthand: true,
    keyboard: true,
    level: 2,
    onChoiceEnd: function() {
      console.log(this.values)
    }
  });
  selector1.setCityVal('福建省, 龙岩市');

  // 模拟城市-联动/搜索/键盘操作
  var selector2 = $('#city-picker-search1').cityPicker({
    dataJson: cityData,
    renderMode: true,
    search: true,
    autoSelected: true,
    shorthand: true,
    keyboard: true,
    level: 2,
    onChoiceEnd: function() {
      console.log(this.values)
    }
  });



</script>

</body>
</html>